package com.gitee.llj.api.controller.sys;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.gitee.llj.api.service.sys.ISysUserService;
import com.gitee.llj.entity.sys.SysUser;
import com.gitee.llj.tools.base.BaseController;
import com.gitee.llj.tools.base.ResultModel;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p></p>
 *
 * @Author llj
 * @Date 2018/3/27
 */
@RestController
@RequestMapping("/api/sysuser")
public class ApiSysUserController extends BaseController {

    @Resource
    private ISysUserService sysUserService;

    /**
     * 根据用户名查找用户信息
     * @param username
     * @return
     */
    @RequestMapping("/info-by-username")
    public ResultModel getUserInfoByUserName(@RequestParam("username") String username){
        EntityWrapper<SysUser> entityWrapper=new EntityWrapper<>();
        entityWrapper.eq("username",username);
        entityWrapper.eq("deleted","0");
        return ResultModel.ok(sysUserService.selectOne(entityWrapper));
    }
}
